package com.ubox.mqtt_upush.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ubox.mqtt_upush.mqttclient.FuseMQTTClientProvider;

@Configuration
@ConfigurationProperties(prefix = "mqtt")
public class MqttClientConfig {

	private int port;

	@Bean
	public FuseMQTTClientProvider MqttClientInitialize() throws Exception {
		final FuseMQTTClientProvider provider = new FuseMQTTClientProvider();
		provider.setUrl("tcp://localhost:" + getPort());
		return provider;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

}
